

#ifndef __MY_BALL_H__
#define __MY_BALL_H__

#include "cocos2d.h"

USING_NS_CC;

typedef enum tagCMyBallState 
{
	kPaddleStateGrabbed,
	kPaddleStateUngrabbed
} CMyBallState; 

class CMyBall : public CCSprite, public CCTargetedTouchDelegate
{
	CMyBallState		m_state;
	CCParticleSystem*	m_emitter;

	CCCallFuncND*		m_onSend_begin;
	CCCallFuncND*		m_onSend_end;
public:
	CMyBall(void);
	virtual ~CMyBall(void);

	CCRect rect( void );
	CCPoint point( void );
	bool initWithTexture(CCTexture2D* aTexture);
	bool initWithSpriteFrame( char* sFrame );
	
	void setActionCallBack( CCCallFuncND* onSend_begin, CCCallFuncND* onSend_end );

	void stopMyActions( void );

	void setNormalStatusActions( void );

	void setMoveStatusActions( CCTouch* touch );
	void onMoveActionEnd( CCNode* sender, void* data );

	void setEndStatusActions( int endtype );
	void onEndActionsEnd( void );

	virtual void onEnter( void );
	virtual void onExit( void );
	bool containsTouchLocation(CCTouch* touch);
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
	virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
	virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
	virtual CCObject* copyWithZone(CCZone *pZone);

	virtual void touchDelegateRetain();
	virtual void touchDelegateRelease();


	static CMyBall* ballWithTexture(CCTexture2D* aTexture);
	static CMyBall* ballWithSpriteFrame(char* sFrame );
};

#endif

